package com.wd.tech.view.activity;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.wd.tech.R;
import com.wd.tech.adapter.News.PlateMoreAdapter;
import com.wd.tech.base.BaseActivity;
import com.wd.tech.base.BasePresenter;
import com.wd.tech.bean.News_Plate_Channel_Bean;
import com.wd.tech.mvp.IPresenterImpl;
import com.wd.tech.url.BaseUrl;

public class NewsMoreActivity extends BaseActivity {


    private RecyclerView inchannel;
    private PlateMoreAdapter plateMoreAdapter;

    @Override
    protected void initData() {

        mPresenter.PresenterGetChannel(BaseUrl.Channel, News_Plate_Channel_Bean.class);
        inchannel.setLayoutManager(new GridLayoutManager(NewsMoreActivity.this,2));
    }

    @Override
    protected void initView() {
        inchannel = findViewById(R.id.Interest_channel);
    }

    @Override
    protected BasePresenter initPresenter() {
        return new IPresenterImpl();
    }

    @Override
    protected int layoutId() {
        return R.layout.activity_news_more;
    }


    @Override
    public void success(Object o) {

        if (o instanceof News_Plate_Channel_Bean){
                plateMoreAdapter = new PlateMoreAdapter(NewsMoreActivity.this, ((News_Plate_Channel_Bean) o).getResult());
                inchannel.setAdapter(plateMoreAdapter);
        }

    }

    @Override
    public void Error(Throwable throwable) {

    }

}
